

#include <wx/window.h>

#include <sdk.h>
#include <cbproject.h>
#include <globals.h>
#include <manager.h>
#include <projectmanager.h>

#include "headerfixup.h"
#include "configuration.h"
#include "execution.h"


namespace
{
  PluginRegistrant<HeaderFixup> reg(_T("HeaderFixup"));
}


HeaderFixup::HeaderFixup() {
  if ( !Manager::LoadResource(_T("headerfixup.zip")) )
    NotifyMissingFile(_T("headerfixup.zip"));
}

HeaderFixup::~HeaderFixup() {
}

void HeaderFixup::OnAttach() {
}

void HeaderFixup::OnRelease(bool ) {
}

int HeaderFixup::Execute() {
 
  if ( !IsAttached() )
    return -1;

 
  const cbProject* prj = Manager::Get()->GetProjectManager()->GetActiveProject();
  if (!prj)
  {
    cbMessageBox(_("You need to open a project/workspace before using this plugin!"),
                 _T("Header Fixup"), wxICON_ERROR | wxOK);
    return -1;
  }

  Execution Dlg(NULL);
  Dlg.ShowModal();
  return 0;
}

cbConfigurationPanel* HeaderFixup::GetConfigurationPanel(wxWindow* parent) {
  return new Configuration(parent);
}// GetConfigurationPanel
